package com.ruoyi.project.card.service.impl;

import java.util.List;
        import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.card.mapper.AlumniArticleMapper;
import com.ruoyi.project.card.domain.AlumniArticle;
import com.ruoyi.project.card.service.IAlumniArticleService;

/**
 * 校园新闻Service业务层处理
 *
 * @author hongwj
 * @date 2024-05-03
 */
@Service
public class AlumniArticleServiceImpl implements IAlumniArticleService {
    @Autowired
    private AlumniArticleMapper alumniArticleMapper;

    /**
     * 查询校园新闻
     *
     * @param id 校园新闻主键
     * @return 校园新闻
     */
    @Override
    public AlumniArticle selectAlumniArticleById(Long id) {
        return alumniArticleMapper.selectAlumniArticleById(id);
    }

    /**
     * 查询校园新闻列表
     *
     * @param alumniArticle 校园新闻
     * @return 校园新闻
     */
    @Override
    public List<AlumniArticle> selectAlumniArticleList(AlumniArticle alumniArticle) {
        return alumniArticleMapper.selectAlumniArticleList(alumniArticle);
    }

    /**
     * 新增校园新闻
     *
     * @param alumniArticle 校园新闻
     * @return 结果
     */
    @Override
    public int insertAlumniArticle(AlumniArticle alumniArticle) {
        alumniArticle.setCreateBy(SecurityUtils.getUserId().toString());

        alumniArticle.setCreateTime(DateUtils.getNowDate());
            return alumniArticleMapper.insertAlumniArticle(alumniArticle);
    }

    /**
     * 修改校园新闻
     *
     * @param alumniArticle 校园新闻
     * @return 结果
     */
    @Override
    public int updateAlumniArticle(AlumniArticle alumniArticle) {
                alumniArticle.setUpdateTime(DateUtils.getNowDate());
        return alumniArticleMapper.updateAlumniArticle(alumniArticle);
    }

    /**
     * 批量删除校园新闻
     *
     * @param ids 需要删除的校园新闻主键
     * @return 结果
     */
    @Override
    public int deleteAlumniArticleByIds(Long[] ids) {
        return alumniArticleMapper.deleteAlumniArticleByIds(ids);
    }

    /**
     * 删除校园新闻信息
     *
     * @param id 校园新闻主键
     * @return 结果
     */
    @Override
    public int deleteAlumniArticleById(Long id) {
        return alumniArticleMapper.deleteAlumniArticleById(id);
    }
}
